package com.blb.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.blb.entity.Staff;
import com.blb.entity.StayProduction;
import com.blb.entity.User;
import com.blb.service.IStayProductionService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *生产管理的待生产订单
 * @author tb
 * @since 2020-05-26
 */
@Controller
@RequestMapping("/stayProduction")
public class StayProductionController {

    @Autowired
    IStayProductionService iStayProductionService;
    @RequiresPermissions("waitproductionorder")
    @RequestMapping("/list")
    @ResponseBody
    public Map<String, Object> list(Integer page, Integer limit){
        User user = (User) SecurityUtils.getSubject().getPrincipal();
        List list = iStayProductionService.stayList(page,limit,user.getCompanyId());
        Map<String,Object> map = new LinkedHashMap<>();
        map.put("code",0);
        map.put("msg","");
        map.put("count",iStayProductionService.getCount(user.getCompanyId()));
        map.put("data",list);
        return map;
    }
    @RequiresPermissions("waitproductionorder")
    @RequestMapping("/like")
    @ResponseBody
    public Map<String, Object> getLike(String orderId,Integer state){
        User user = (User) SecurityUtils.getSubject().getPrincipal();
        List<StayProduction> name = iStayProductionService.getLike(orderId,state,user.getCompanyId());
        System.out.println(name);
        Map<String,Object> map = new LinkedHashMap<>();
        map.put("code",0);
        map.put("msg","");
        map.put("count",iStayProductionService.getCount(user.getCompanyId()));
        map.put("data",name);
        return map;
    }
}

